feat: Phase 4 — Telegram interactive approval bot#9
Open
constgemm wants to merge 2 commits into
Open
Conversation
Moves the propose-then-approve gate from the terminal (--commit) to the phone.
For each NEW candidate not contradicted by Dawarich, telegram.py sends a card
showing every field (missing ones flagged) with an Approve/Skip inline button;
on Approve it writes the flight to AirTrail and replies with the new total
("AirTrail now has N flights"). Skip or timeout writes nothing.
Uses long-poll getUpdates, so the container needs no inbound port. callback_data
is namespaced (lay:ok:<idx>) and decisions are buffered by index, so stray or
out-of-order taps are handled. All HTTP + AirTrail post/fetch are injectable.
- populate.py: opt-in approval step (env TELEGRAM_APPROVE or --telegram-approve).
- Dockerfile copies telegram.py; .env.example + README document it (token is a
SECRET — .env only).
- 10 tests: card rendering, eligibility filter, approve/skip/timeout/failure
paths, enable gating. Full suite: 39 green.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
# Conflicts: # .env.example # Dockerfile # populate.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The propose-then-approve gate, moved from the terminal (
--commit) to your phone.Flow
For each new candidate not contradicted by Dawarich,
telegram.py:⚠ missing— with an inline ✅ Approve / ⏭ Skip keyboard;getUpdates, so the container needs no inbound port);Robustness
callback_datais namespaced (lay:ok:<idx>) so taps from other bots in the chat are ignored; decisions are buffered by index so out-of-order/duplicate taps aren't lost.post/fetchare injectable → fully tested offline.Changes
telegram.py— config, Bot API transport, card rendering, approval session,run_approvals.populate.py— opt-in step (TELEGRAM_APPROVE=1or--telegram-approve).Dockerfile,.env.example, README.tests/test_telegram.py— 10 tests. Suite on this branch: 39 green.Needs from you: a bot token from @Botfather + your chat id (→
.env/infra-secrets, never committed). The token is a secret — keep it out of the vault.🤖 Generated with Claude Code